home *** CD-ROM | disk | FTP | other *** search
- Path: news.computek.net!usenet
- From: robert jacobs and jason jacobs <robertj@computek.net>
- Newsgroups: comp.lang.c
- Subject: Re: (no subject)
- Date: Thu, 29 Feb 1996 11:10:15 -0600
- Organization: Compu-Net DFW's Premiere Internet Access Provider
- Message-ID: <3135DDF7.4189@computek.net>
- References: <4gv493$p09@nuacht.iol.ie>
- NNTP-Posting-Host: dal834.computek.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win95; I)
-
- Roy Leonard wrote:
- >
- > Hi all,
- >
- > I have a strange problem from an embedded system. I have an array of
- > data, and
- > I want to count all the high bits (=1) in the array.
- >
- > Hopefully there is a way I can do this in C at high speed. The
- > alternative is assembler, which I would prefer not to do, but I may have
- > to. Does anyone have any nifty ideas about how I might go about this?
- >
- > The data is of fixed length (roughly 50 long ints). Each bit is evenly
- > weighted.
- > Eg.
- >
- > If the data in binary was "1001001", the total I'm looking for is three.
- >
- > Looking forward to some interesting responses!
- >
- > Roy
- > --
- > -==-
- > Roy Leonard
- > leonardr@iol.ie
- > Development Engineer
- >
- > "Stress is when your mouth says 'No Problem' and your gut says 'NO WAY'"
- > -==-Use the Binary Operator Expressions of "C".
- You can flip bits, count, compare, mask, and test with these operator's
- as fast as assy.
-
- Use a subject in your subject line next time.
-
- BJ
-